package com.han.hotelplat.service.holiday.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.han.hotelplat.comm.base.EntityManage;
import com.han.hotelplat.pojo.holiday.Holiday;
import com.han.hotelplat.service.holiday.HolidayService;

@Service
public class HolidayServiceImpl implements HolidayService{
	@Autowired
	private EntityManage entityManage;

	@Override
	public List<Holiday> getAllHoliday() {
		return entityManage.findAll("Holiday");
	}

	@Override
	public void replaceHoliday(List<Holiday> newHolidays) {
		entityManage.deleteByHql("DELETE  FROM  tb_holiday");
		for(Holiday h : newHolidays){
			entityManage.save(h);
		}
	}
	
}
